const path = require("path");  // 处理路径
const HtmlWebpackPlugin = require('html-webpack-plugin')
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
// CommonJS - webpack基于node环静，对前端的代码进行打包
module.exports = {
    entry: './src/main.js',   // 打包入口
    output: {        // 打包出口
        path: path.resolve(__dirname, "dist"), // 出口文件夹绝对路径
        filename: "bundle.js",  // 出口文件
    },
    plugins: [new MiniCssExtractPlugin()],
    module: { 
        rules: [ // loader的规则
            {test: /\.css$/, use: [MiniCssExtractPlugin.loader, 'css-loader']},
            {test: /\.less$/, use: [MiniCssExtractPlugin.loader, 'css-loader', 'less-loader']},
        ]
    }
    
}